import hashlib

date_str = '123456'
print(date_str.encode('utf-8'))  # 转成2进制

md5_obj = hashlib.md5(date_str.encode('utf-8'))

# 转成16进制输出
md5_srt = md5_obj.hexdigest()
print(md5_srt)
